var userRole,userRoleId, projectKid, subId;
var clientHeight = $(document).height() - 60;
var url = location.search; //获取url中"?"符后的字串 
$(function(){
    if (url.indexOf("?") != -1) { 
        var str = decodeURI(url.substr(1)); 
        var theRequest = new Object(); 
        var strs = str.split("&"); 
        for(var i = 0; i < strs.length; i ++) { 
            theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]); 
        } 
        userRole = theRequest.userRole;
        userRoleId = theRequest.id;
    }
    $('.min-height').css('min-height',clientHeight);
    renderDeclare(userRoleId,'否');
    $('.declare-title ul li').click(function(){
        $(this).addClass('current-text').siblings().removeClass('current-text');
        $(this).find('.current-border').addClass('current');
        $(this).siblings().find('.current-border').removeClass('current');
        var type = $(this).attr('name');
        renderDeclare(userRoleId,type);
    })
})
function renderDeclare(userRoleId,isScore){
    var content = [];
    var tranData = {'pingweiId': userRoleId, 'isScore': isScore, 'nowPage': 1}
    getdata(host + "projectalloc/findScores", tranData,
        function(res){
            content = res.res.data;
            for (var i = 0; i < content.length; i++) {
                content[i].isScore = isScore;
            }
        }
    );
    var data = {
        content: content
    };
    var html = template('declare-list', data);
    document.getElementById('declare-content').innerHTML = html;
}
// 点击申报列表进入详情
$(document).on("click", "#click-declare-list", function (e) {
     var isScore = $(this).attr('name');
     var nameId = $(this).attr('nameId');
     var projectKid = $(this).attr('projectKid');
     window.location.href = $().AbsUrlParse("/web/page/detailMessage?kid=" + projectKid + '&subId=' + nameId + '&isScore=' + isScore + '&userRole=' + userRole);
    //  window.location.href = "detail-message.html?kid=" + projectKid + '&subId=' + subId + '&isScore=' + isScore + '&userRole=' + userRole
});
